using Godot;
using System;

public partial class WeaponRepairVFX : BaseVFX
{
    AnimationPlayer animationPlayer;
    Label label;

    public override void _Ready()
    {
        base._Ready();
        label = GetNode<Label>("Label");
        animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
        animationPlayer.AnimationFinished += OnAnimationFinishedHandler;
    }

    private void OnAnimationFinishedHandler(StringName animName)
    {
        Hide();
        EmitSignal(SignalName.OnVFXEnd);
    }

    public void Play(Vector2 pos, int amount)
    {
        Show();
        label.Text = "+ " + amount;
        Position = pos;
        animationPlayer.Play("bounce");
        AudioManager.PlayEffect("recover");
    }
}
